package hn.cch.web.request.entity;

import hn.cch.web.request.validate.ValidatePost;
import hn.cch.web.request.validate.ValidatePut;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

public class ValidateEntity {

    @Min(value = 0)
    @Max(value = 9)
    private Integer integer;

    @Range(min = 0, max = 1)
    private Double fraction;// 小数

    @NotBlank
    @Size(groups = {ValidatePost.class}, min = 4)
    @Size(groups = {ValidatePut.class}, min = 8)
    private String string;

    @Valid
    private ParameterModel model;

    public Integer getInteger() {
        return integer;
    }

    public void setInteger(Integer integer) {
        this.integer = integer;
    }

    public Double getFraction() {
        return fraction;
    }

    public void setFraction(Double fraction) {
        this.fraction = fraction;
    }

    public String getString() {
        return string;
    }

    public void setString(String string) {
        this.string = string;
    }

    public ParameterModel getModel() {
        return model;
    }

    public void setModel(ParameterModel model) {
        this.model = model;
    }
}
